<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>epydoc.test.util</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="epydoc-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://epydoc.sourceforge.net">epydoc 3.0beta1</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="epydoc-module.html">Package&nbsp;epydoc</a> ::
        <a href="epydoc.test-module.html">Package&nbsp;test</a> ::
        Module&nbsp;util
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="epydoc.test.util-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="epydoc.test.util-module.html">Module epydoc.test.util</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># epydoc -- Utility functions used by regression tests (*.doctest)</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Edward Loper</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Created [01/30/01 05:18 PM]</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># $Id: html.py 1420 2007-01-28 14:19:30Z dvarrazzo $</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">Utility functions used by the regression tests (C{*.doctest}).</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">'epytext en'</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">tempfile</tt><tt class="py-op">,</tt> <tt class="py-name">re</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Variable epydoc.apidoc.ModuleDoc.path=epydoc.apidoc.ModuleDoc-class.html#path"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-0', 'path', 'link-0');">path</a></tt><tt class="py-op">,</tt> <tt class="py-name">textwrap</tt><tt class="py-op">,</tt> <tt class="py-name">sys</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Package epydoc=epydoc-module.html"><a title="epydoc" class="py-name" href="#" onclick="return doclink('link-1', 'epydoc', 'link-1');">epydoc</a></tt><tt class="py-op">.</tt><tt id="link-2" class="py-name" targets="Module epydoc.docbuilder=epydoc.docbuilder-module.html"><a title="epydoc.docbuilder" class="py-name" href="#" onclick="return doclink('link-2', 'docbuilder', 'link-2');">docbuilder</a></tt> <tt class="py-keyword">import</tt> <tt id="link-3" class="py-name" targets="Function epydoc.docbuilder.build_doc()=epydoc.docbuilder-module.html#build_doc"><a title="epydoc.docbuilder.build_doc" class="py-name" href="#" onclick="return doclink('link-3', 'build_doc', 'link-3');">build_doc</a></tt><tt class="py-op">,</tt> <tt id="link-4" class="py-name" targets="Function epydoc.docbuilder.build_doc_index()=epydoc.docbuilder-module.html#build_doc_index"><a title="epydoc.docbuilder.build_doc_index" class="py-name" href="#" onclick="return doclink('link-4', 'build_doc_index', 'link-4');">build_doc_index</a></tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-5" class="py-name"><a title="epydoc" class="py-name" href="#" onclick="return doclink('link-5', 'epydoc', 'link-1');">epydoc</a></tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Module epydoc.docparser=epydoc.docparser-module.html"><a title="epydoc.docparser" class="py-name" href="#" onclick="return doclink('link-6', 'docparser', 'link-6');">docparser</a></tt> <tt class="py-keyword">import</tt> <tt id="link-7" class="py-name" targets="Function epydoc.docparser.parse_docs()=epydoc.docparser-module.html#parse_docs"><a title="epydoc.docparser.parse_docs" class="py-name" href="#" onclick="return doclink('link-7', 'parse_docs', 'link-7');">parse_docs</a></tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-8" class="py-name"><a title="epydoc" class="py-name" href="#" onclick="return doclink('link-8', 'epydoc', 'link-1');">epydoc</a></tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Module epydoc.docintrospecter=epydoc.docintrospecter-module.html"><a title="epydoc.docintrospecter" class="py-name" href="#" onclick="return doclink('link-9', 'docintrospecter', 'link-9');">docintrospecter</a></tt> <tt class="py-keyword">import</tt> <tt id="link-10" class="py-name" targets="Function epydoc.docintrospecter.introspect_docs()=epydoc.docintrospecter-module.html#introspect_docs"><a title="epydoc.docintrospecter.introspect_docs" class="py-name" href="#" onclick="return doclink('link-10', 'introspect_docs', 'link-10');">introspect_docs</a></tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-11" class="py-name"><a title="epydoc" class="py-name" href="#" onclick="return doclink('link-11', 'epydoc', 'link-1');">epydoc</a></tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Module epydoc.apidoc=epydoc.apidoc-module.html"><a title="epydoc.apidoc" class="py-name" href="#" onclick="return doclink('link-12', 'apidoc', 'link-12');">apidoc</a></tt> <tt class="py-keyword">import</tt> <tt id="link-13" class="py-name" targets="Class epydoc.apidoc.ClassDoc=epydoc.apidoc.ClassDoc-class.html"><a title="epydoc.apidoc.ClassDoc" class="py-name" href="#" onclick="return doclink('link-13', 'ClassDoc', 'link-13');">ClassDoc</a></tt><tt class="py-op">,</tt> <tt id="link-14" class="py-name" targets="Class epydoc.apidoc.RoutineDoc=epydoc.apidoc.RoutineDoc-class.html"><a title="epydoc.apidoc.RoutineDoc" class="py-name" href="#" onclick="return doclink('link-14', 'RoutineDoc', 'link-14');">RoutineDoc</a></tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-15" class="py-name"><a title="epydoc" class="py-name" href="#" onclick="return doclink('link-15', 'epydoc', 'link-1');">epydoc</a></tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Package epydoc.markup=epydoc.markup-module.html,Method epydoc.markup.doctest.DoctestColorizer.markup()=epydoc.markup.doctest.DoctestColorizer-class.html#markup,Method epydoc.markup.doctest.HTMLDoctestColorizer.markup()=epydoc.markup.doctest.HTMLDoctestColorizer-class.html#markup,Method epydoc.markup.doctest.LaTeXDoctestColorizer.markup()=epydoc.markup.doctest.LaTeXDoctestColorizer-class.html#markup,Method epydoc.markup.doctest.XMLDoctestColorizer.markup()=epydoc.markup.doctest.XMLDoctestColorizer-class.html#markup"><a title="epydoc.markup
epydoc.markup.doctest.DoctestColorizer.markup
epydoc.markup.doctest.HTMLDoctestColorizer.markup
epydoc.markup.doctest.LaTeXDoctestColorizer.markup
epydoc.markup.doctest.XMLDoctestColorizer.markup" class="py-name" href="#" onclick="return doclink('link-16', 'markup', 'link-16');">markup</a></tt> <tt class="py-keyword">import</tt> <tt id="link-17" class="py-name" targets="Class epydoc.markup.ParsedDocstring=epydoc.markup.ParsedDocstring-class.html"><a title="epydoc.markup.ParsedDocstring" class="py-name" href="#" onclick="return doclink('link-17', 'ParsedDocstring', 'link-17');">ParsedDocstring</a></tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-18" class="py-name"><a title="epydoc" class="py-name" href="#" onclick="return doclink('link-18', 'epydoc', 'link-1');">epydoc</a></tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Package epydoc.docwriter=epydoc.docwriter-module.html"><a title="epydoc.docwriter" class="py-name" href="#" onclick="return doclink('link-19', 'docwriter', 'link-19');">docwriter</a></tt><tt class="py-op">.</tt><tt id="link-20" class="py-name" targets="Module epydoc.docwriter.html=epydoc.docwriter.html-module.html"><a title="epydoc.docwriter.html" class="py-name" href="#" onclick="return doclink('link-20', 'html', 'link-20');">html</a></tt> <tt class="py-keyword">import</tt> <tt id="link-21" class="py-name" targets="Class epydoc.docwriter.html.HTMLWriter=epydoc.docwriter.html.HTMLWriter-class.html"><a title="epydoc.docwriter.html.HTMLWriter" class="py-name" href="#" onclick="return doclink('link-21', 'HTMLWriter', 'link-21');">HTMLWriter</a></tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-comment">######################################################################</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#{ Test Functions</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">######################################################################</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="buildvaluedoc"></a><div id="buildvaluedoc-def"><a name="L26"></a><tt class="py-lineno"> 26</tt> <a class="py-toggle" href="#" id="buildvaluedoc-toggle" onclick="return toggle('buildvaluedoc');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#buildvaluedoc">buildvaluedoc</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="buildvaluedoc-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="buildvaluedoc-expanded"><a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">    This test function takes a string containing the contents of a</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">    module.  It writes the string contents to a file, imports the file</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">    as a module, and uses build_doc to build documentation, and</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    returns it as a C{ValueDoc} object.</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">    <tt class="py-name">tmp_dir</tt> <tt class="py-op">=</tt> <tt id="link-22" class="py-name" targets="Function epydoc.test.util.write_pystring_to_tmp_dir()=epydoc.test.util-module.html#write_pystring_to_tmp_dir"><a title="epydoc.test.util.write_pystring_to_tmp_dir" class="py-name" href="#" onclick="return doclink('link-22', 'write_pystring_to_tmp_dir', 'link-22');">write_pystring_to_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">    <tt class="py-name">val_doc</tt> <tt class="py-op">=</tt> <tt id="link-23" class="py-name"><a title="epydoc.docbuilder.build_doc" class="py-name" href="#" onclick="return doclink('link-23', 'build_doc', 'link-3');">build_doc</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-24', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt> <tt class="py-string">'epydoc_test.py'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">    <tt id="link-25" class="py-name" targets="Function epydoc.test.util.cleanup_tmp_dir()=epydoc.test.util-module.html#cleanup_tmp_dir"><a title="epydoc.test.util.cleanup_tmp_dir" class="py-name" href="#" onclick="return doclink('link-25', 'cleanup_tmp_dir', 'link-25');">cleanup_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">val_doc</tt> </tt>
</div><a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"> </tt>
<a name="runbuilder"></a><div id="runbuilder-def"><a name="L38"></a><tt class="py-lineno"> 38</tt> <a class="py-toggle" href="#" id="runbuilder-toggle" onclick="return toggle('runbuilder');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#runbuilder">runbuilder</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">attribs</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt> <tt class="py-param">build</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">exclude</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="runbuilder-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="runbuilder-expanded"><a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">    This test function takes a string containing the contents of a</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">    module.  It writes the string contents to a file, imports the file</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">    as a module, and uses build_doc to build documentation, and pretty</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">    prints the resulting ModuleDoc object.  The C{attribs} argument</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">    specifies which attributes of the C{APIDoc}s should be displayed.</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">    The C{build} argument gives the name of a variable in the module</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring">    whose documentation should be built, instead of bilding docs for</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">    the whole module.</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">    <tt class="py-comment"># Write it to a temp file.</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">tmp_dir</tt> <tt class="py-op">=</tt> <tt id="link-26" class="py-name"><a title="epydoc.test.util.write_pystring_to_tmp_dir" class="py-name" href="#" onclick="return doclink('link-26', 'write_pystring_to_tmp_dir', 'link-22');">write_pystring_to_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">    <tt class="py-comment"># Build it.</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">val_doc</tt> <tt class="py-op">=</tt> <tt id="link-27" class="py-name"><a title="epydoc.docbuilder.build_doc" class="py-name" href="#" onclick="return doclink('link-27', 'build_doc', 'link-3');">build_doc</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-28', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt> <tt class="py-string">'epydoc_test.py'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">build</tt><tt class="py-op">:</tt> <tt class="py-name">val_doc</tt> <tt class="py-op">=</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name" targets="Variable epydoc.apidoc.NamespaceDoc.variables=epydoc.apidoc.NamespaceDoc-class.html#variables"><a title="epydoc.apidoc.NamespaceDoc.variables" class="py-name" href="#" onclick="return doclink('link-29', 'variables', 'link-29');">variables</a></tt><tt class="py-op">[</tt><tt class="py-name">build</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name" targets="Variable epydoc.apidoc.VariableDoc.value=epydoc.apidoc.VariableDoc-class.html#value"><a title="epydoc.apidoc.VariableDoc.value" class="py-name" href="#" onclick="return doclink('link-30', 'value', 'link-30');">value</a></tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">    <tt class="py-comment"># Display it.</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">val_doc</tt><tt class="py-op">,</tt> <tt id="link-31" class="py-name"><a title="epydoc.apidoc.ClassDoc" class="py-name" href="#" onclick="return doclink('link-31', 'ClassDoc', 'link-13');">ClassDoc</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">val</tt> <tt class="py-keyword">in</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name"><a title="epydoc.apidoc.NamespaceDoc.variables" class="py-name" href="#" onclick="return doclink('link-32', 'variables', 'link-29');">variables</a></tt><tt class="py-op">.</tt><tt class="py-name">values</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="epydoc.apidoc.VariableDoc.value" class="py-name" href="#" onclick="return doclink('link-33', 'value', 'link-30');">value</a></tt><tt class="py-op">,</tt> <tt id="link-34" class="py-name"><a title="epydoc.apidoc.RoutineDoc" class="py-name" href="#" onclick="return doclink('link-34', 'RoutineDoc', 'link-14');">RoutineDoc</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">                <tt id="link-35" class="py-name" targets="Function epydoc.test.util.fun_to_plain()=epydoc.test.util-module.html#fun_to_plain"><a title="epydoc.test.util.fun_to_plain" class="py-name" href="#" onclick="return doclink('link-35', 'fun_to_plain', 'link-35');">fun_to_plain</a></tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name"><a title="epydoc.apidoc.VariableDoc.value" class="py-name" href="#" onclick="return doclink('link-36', 'value', 'link-30');">value</a></tt><tt class="py-op">)</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name" targets="Method epydoc.apidoc.APIDoc.pp()=epydoc.apidoc.APIDoc-class.html#pp"><a title="epydoc.apidoc.APIDoc.pp" class="py-name" href="#" onclick="return doclink('link-37', 'pp', 'link-37');">pp</a></tt><tt class="py-op">(</tt><tt class="py-name">include</tt><tt class="py-op">=</tt><tt class="py-name">attribs</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">exclude</tt><tt class="py-op">=</tt><tt class="py-name">exclude</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(filename = ).*"</tt><tt class="py-op">,</tt> <tt class="py-string">r"\1..."</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(&lt;module 'epydoc_test' from ).*"</tt><tt class="py-op">,</tt> <tt class="py-string">r'\1...'</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(&lt;function \w+ at )0x\w+&gt;"</tt><tt class="py-op">,</tt> <tt class="py-string">r"\1...&gt;"</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(&lt;\w+ object at )0x\w+&gt;"</tt><tt class="py-op">,</tt> <tt class="py-string">r"\1...&gt;"</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">s</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">    <tt class="py-comment"># Clean up.</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt id="link-38" class="py-name"><a title="epydoc.test.util.cleanup_tmp_dir" class="py-name" href="#" onclick="return doclink('link-38', 'cleanup_tmp_dir', 'link-25');">cleanup_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
</div><a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"> </tt>
<a name="runparser"></a><div id="runparser-def"><a name="L68"></a><tt class="py-lineno"> 68</tt> <a class="py-toggle" href="#" id="runparser-toggle" onclick="return toggle('runparser');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#runparser">runparser</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">attribs</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt> <tt class="py-param">show</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">exclude</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="runparser-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="runparser-expanded"><a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-docstring">    This test function takes a string containing the contents of a</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-docstring">    module, and writes it to a file, uses `parse_docs` to parse it,</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-docstring">    and pretty prints the resulting ModuleDoc object.  The `attribs`</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-docstring">    argument specifies which attributes of the `APIDoc`s should be</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-docstring">    displayed.  The `show` argument, if specifies, gives the name of</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-docstring">    the object in the module that should be displayed (but the whole</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-docstring">    module will always be inspected; this just selects what to</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-docstring">    display).</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">    <tt class="py-comment"># Write it to a temp file.</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">tmp_dir</tt> <tt class="py-op">=</tt> <tt id="link-39" class="py-name"><a title="epydoc.test.util.write_pystring_to_tmp_dir" class="py-name" href="#" onclick="return doclink('link-39', 'write_pystring_to_tmp_dir', 'link-22');">write_pystring_to_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">    <tt class="py-comment"># Parse it.</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">val_doc</tt> <tt class="py-op">=</tt> <tt id="link-40" class="py-name"><a title="epydoc.docparser.parse_docs" class="py-name" href="#" onclick="return doclink('link-40', 'parse_docs', 'link-7');">parse_docs</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-41', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt> <tt class="py-string">'epydoc_test.py'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">show</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt id="link-42" class="py-name" targets="Variable epydoc.apidoc.VariableDoc.name=epydoc.apidoc.VariableDoc-class.html#name"><a title="epydoc.apidoc.VariableDoc.name" class="py-name" href="#" onclick="return doclink('link-42', 'name', 'link-42');">name</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">show</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">'.'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">val_doc</tt><tt class="py-op">,</tt> <tt id="link-43" class="py-name"><a title="epydoc.apidoc.ClassDoc" class="py-name" href="#" onclick="return doclink('link-43', 'ClassDoc', 'link-13');">ClassDoc</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">                <tt class="py-name">val_doc</tt> <tt class="py-op">=</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt class="py-name">local_variables</tt><tt class="py-op">[</tt><tt id="link-44" class="py-name"><a title="epydoc.apidoc.VariableDoc.name" class="py-name" href="#" onclick="return doclink('link-44', 'name', 'link-42');">name</a></tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="epydoc.apidoc.VariableDoc.value" class="py-name" href="#" onclick="return doclink('link-45', 'value', 'link-30');">value</a></tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">                <tt class="py-name">val_doc</tt> <tt class="py-op">=</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="epydoc.apidoc.NamespaceDoc.variables" class="py-name" href="#" onclick="return doclink('link-46', 'variables', 'link-29');">variables</a></tt><tt class="py-op">[</tt><tt id="link-47" class="py-name"><a title="epydoc.apidoc.VariableDoc.name" class="py-name" href="#" onclick="return doclink('link-47', 'name', 'link-42');">name</a></tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="epydoc.apidoc.VariableDoc.value" class="py-name" href="#" onclick="return doclink('link-48', 'value', 'link-30');">value</a></tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">    <tt class="py-comment"># Display it.</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="epydoc.apidoc.APIDoc.pp" class="py-name" href="#" onclick="return doclink('link-49', 'pp', 'link-37');">pp</a></tt><tt class="py-op">(</tt><tt class="py-name">include</tt><tt class="py-op">=</tt><tt class="py-name">attribs</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">exclude</tt><tt class="py-op">=</tt><tt class="py-name">exclude</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"filename = .*"</tt><tt class="py-op">,</tt> <tt class="py-string">"filename = ..."</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">s</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">    <tt class="py-comment"># Clean up.</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt id="link-50" class="py-name"><a title="epydoc.test.util.cleanup_tmp_dir" class="py-name" href="#" onclick="return doclink('link-50', 'cleanup_tmp_dir', 'link-25');">cleanup_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
</div><a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line"> </tt>
<a name="runintrospecter"></a><div id="runintrospecter-def"><a name="L96"></a><tt class="py-lineno"> 96</tt> <a class="py-toggle" href="#" id="runintrospecter-toggle" onclick="return toggle('runintrospecter');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#runintrospecter">runintrospecter</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">attribs</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt> <tt class="py-param">introspect</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">exclude</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="runintrospecter-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="runintrospecter-expanded"><a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line"><tt class="py-docstring">    This test function takes a string containing the contents of a</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line"><tt class="py-docstring">    module.  It writes the string contents to a file, imports the file</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"><tt class="py-docstring">    as a module, and uses C{introspect_docs} to introspect it, and</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line"><tt class="py-docstring">    pretty prints the resulting ModuleDoc object.  The C{attribs}</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line"><tt class="py-docstring">    argument specifies which attributes of the C{APIDoc}s should be</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line"><tt class="py-docstring">    displayed.  The C{introspect} argument gives the name of a variable</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line"><tt class="py-docstring">    in the module whose value should be introspected, instead of</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line"><tt class="py-docstring">    introspecting the whole module.</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">    <tt class="py-comment"># Write it to a temp file.</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">tmp_dir</tt> <tt class="py-op">=</tt> <tt id="link-51" class="py-name"><a title="epydoc.test.util.write_pystring_to_tmp_dir" class="py-name" href="#" onclick="return doclink('link-51', 'write_pystring_to_tmp_dir', 'link-22');">write_pystring_to_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">    <tt class="py-comment"># Import it.</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-52', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">insert</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">introspect</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt class="py-keyword">import</tt> <tt class="py-name">epydoc_test</tt> <tt class="py-keyword">as</tt> <tt class="py-name">val</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">        <tt class="py-keyword">exec</tt><tt class="py-op">(</tt><tt class="py-string">"from epydoc_test import %s as val"</tt> <tt class="py-op">%</tt> <tt class="py-name">introspect</tt><tt class="py-op">)</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">    <tt class="py-keyword">del</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-53', 'path', 'link-0');">path</a></tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">    <tt class="py-comment"># Introspect it.</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">val_doc</tt> <tt class="py-op">=</tt> <tt id="link-54" class="py-name"><a title="epydoc.docintrospecter.introspect_docs" class="py-name" href="#" onclick="return doclink('link-54', 'introspect_docs', 'link-10');">introspect_docs</a></tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">)</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">    <tt class="py-comment"># Display it.</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-55" class="py-name"><a title="epydoc.apidoc.APIDoc.pp" class="py-name" href="#" onclick="return doclink('link-55', 'pp', 'link-37');">pp</a></tt><tt class="py-op">(</tt><tt class="py-name">include</tt><tt class="py-op">=</tt><tt class="py-name">attribs</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">exclude</tt><tt class="py-op">=</tt><tt class="py-name">exclude</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(filename = ).*"</tt><tt class="py-op">,</tt> <tt class="py-string">r"\1..."</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(&lt;module 'epydoc_test' from ).*"</tt><tt class="py-op">,</tt> <tt class="py-string">r'\1...'</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(&lt;function \w+ at )0x\w+&gt;"</tt><tt class="py-op">,</tt> <tt class="py-string">r"\1...&gt;"</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r"(&lt;\w+ object at )0x\w+&gt;"</tt><tt class="py-op">,</tt> <tt class="py-string">r"\1...&gt;"</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">s</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">    <tt class="py-comment"># Clean up.</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt id="link-56" class="py-name"><a title="epydoc.test.util.cleanup_tmp_dir" class="py-name" href="#" onclick="return doclink('link-56', 'cleanup_tmp_dir', 'link-25');">cleanup_tmp_dir</a></tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
</div><a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line"> </tt>
<a name="print_warnings"></a><div id="print_warnings-def"><a name="L128"></a><tt class="py-lineno">128</tt> <a class="py-toggle" href="#" id="print_warnings-toggle" onclick="return toggle('print_warnings');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#print_warnings">print_warnings</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="print_warnings-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="print_warnings-expanded"><a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line"><tt class="py-docstring">    Register a logger that will print warnings &amp; errors.</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt id="link-57" class="py-name"><a title="epydoc" class="py-name" href="#" onclick="return doclink('link-57', 'epydoc', 'link-1');">epydoc</a></tt> <tt class="py-keyword">import</tt> <tt id="link-58" class="py-name" targets="Method epydoc.cli.ConsoleLogger.log()=epydoc.cli.ConsoleLogger-class.html#log,Method epydoc.cli.HTMLLogger.log()=epydoc.cli.HTMLLogger-class.html#log,Method epydoc.gui.GUILogger.log()=epydoc.gui.GUILogger-class.html#log,Module epydoc.log=epydoc.log-module.html,Method epydoc.log.Logger.log()=epydoc.log.Logger-class.html#log,Method epydoc.log.SimpleLogger.log()=epydoc.log.SimpleLogger-class.html#log"><a title="epydoc.cli.ConsoleLogger.log
epydoc.cli.HTMLLogger.log
epydoc.gui.GUILogger.log
epydoc.log
epydoc.log.Logger.log
epydoc.log.SimpleLogger.log" class="py-name" href="#" onclick="return doclink('link-58', 'log', 'link-58');">log</a></tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">    <tt class="py-keyword">del</tt> <tt id="link-59" class="py-name"><a title="epydoc.cli.ConsoleLogger.log
epydoc.cli.HTMLLogger.log
epydoc.gui.GUILogger.log
epydoc.log
epydoc.log.Logger.log
epydoc.log.SimpleLogger.log" class="py-name" href="#" onclick="return doclink('link-59', 'log', 'link-58');">log</a></tt><tt class="py-op">.</tt><tt id="link-60" class="py-name" targets="Variable epydoc.log._loggers=epydoc.log-module.html#_loggers"><a title="epydoc.log._loggers" class="py-name" href="#" onclick="return doclink('link-60', '_loggers', 'link-60');">_loggers</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">    <tt id="link-61" class="py-name"><a title="epydoc.cli.ConsoleLogger.log
epydoc.cli.HTMLLogger.log
epydoc.gui.GUILogger.log
epydoc.log
epydoc.log.Logger.log
epydoc.log.SimpleLogger.log" class="py-name" href="#" onclick="return doclink('link-61', 'log', 'link-58');">log</a></tt><tt class="py-op">.</tt><tt id="link-62" class="py-name" targets="Function epydoc.log.register_logger()=epydoc.log-module.html#register_logger"><a title="epydoc.log.register_logger" class="py-name" href="#" onclick="return doclink('link-62', 'register_logger', 'link-62');">register_logger</a></tt><tt class="py-op">(</tt><tt id="link-63" class="py-name"><a title="epydoc.cli.ConsoleLogger.log
epydoc.cli.HTMLLogger.log
epydoc.gui.GUILogger.log
epydoc.log
epydoc.log.Logger.log
epydoc.log.SimpleLogger.log" class="py-name" href="#" onclick="return doclink('link-63', 'log', 'link-58');">log</a></tt><tt class="py-op">.</tt><tt id="link-64" class="py-name" targets="Class epydoc.log.SimpleLogger=epydoc.log.SimpleLogger-class.html"><a title="epydoc.log.SimpleLogger" class="py-name" href="#" onclick="return doclink('link-64', 'SimpleLogger', 'link-64');">SimpleLogger</a></tt><tt class="py-op">(</tt><tt id="link-65" class="py-name"><a title="epydoc.cli.ConsoleLogger.log
epydoc.cli.HTMLLogger.log
epydoc.gui.GUILogger.log
epydoc.log
epydoc.log.Logger.log
epydoc.log.SimpleLogger.log" class="py-name" href="#" onclick="return doclink('link-65', 'log', 'link-58');">log</a></tt><tt class="py-op">.</tt><tt id="link-66" class="py-name" targets="Variable epydoc.log.DOCSTRING_WARNING=epydoc.log-module.html#DOCSTRING_WARNING"><a title="epydoc.log.DOCSTRING_WARNING" class="py-name" href="#" onclick="return doclink('link-66', 'DOCSTRING_WARNING', 'link-66');">DOCSTRING_WARNING</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line"> </tt>
<a name="testencoding"></a><div id="testencoding-def"><a name="L136"></a><tt class="py-lineno">136</tt> <a class="py-toggle" href="#" id="testencoding-toggle" onclick="return toggle('testencoding');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#testencoding">testencoding</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">introspect</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-param">parse</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-param">debug</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="testencoding-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="testencoding-expanded"><a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line"><tt class="py-docstring">    An end-to-end test for unicode encodings.  This function takes a</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"><tt class="py-docstring">    given string, writes it to a python file, and processes that</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line"><tt class="py-docstring">    file's documentation.  It then generates HTML output from the</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"><tt class="py-docstring">    documentation, extracts all docstrings from the generated HTML</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line"><tt class="py-docstring">    output, and displays them.  (In order to extract &amp; display all</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line"><tt class="py-docstring">    docstrings, it monkey-patches the HMTLwriter.docstring_to_html()</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"><tt class="py-docstring">    method.)"""</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">    <tt class="py-comment"># Monkey-patch docstring_to_html</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">original_docstring_to_html</tt> <tt class="py-op">=</tt> <tt id="link-67" class="py-name"><a title="epydoc.docwriter.html.HTMLWriter" class="py-name" href="#" onclick="return doclink('link-67', 'HTMLWriter', 'link-21');">HTMLWriter</a></tt><tt class="py-op">.</tt><tt id="link-68" class="py-name" targets="Method epydoc.docwriter.html.HTMLWriter.docstring_to_html()=epydoc.docwriter.html.HTMLWriter-class.html#docstring_to_html"><a title="epydoc.docwriter.html.HTMLWriter.docstring_to_html" class="py-name" href="#" onclick="return doclink('link-68', 'docstring_to_html', 'link-68');">docstring_to_html</a></tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">    <tt id="link-69" class="py-name"><a title="epydoc.docwriter.html.HTMLWriter" class="py-name" href="#" onclick="return doclink('link-69', 'HTMLWriter', 'link-21');">HTMLWriter</a></tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="epydoc.docwriter.html.HTMLWriter.docstring_to_html" class="py-name" href="#" onclick="return doclink('link-70', 'docstring_to_html', 'link-68');">docstring_to_html</a></tt> <tt class="py-op">=</tt> <tt id="link-71" class="py-name" targets="Function epydoc.test.util.print_docstring_as_html()=epydoc.test.util-module.html#print_docstring_as_html"><a title="epydoc.test.util.print_docstring_as_html" class="py-name" href="#" onclick="return doclink('link-71', 'print_docstring_as_html', 'link-71');">print_docstring_as_html</a></tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">     </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">    <tt class="py-comment"># Write s to a temporary file.</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">tmp_dir</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">mkdtemp</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">    <tt id="link-72" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-72', 'path', 'link-0');">path</a></tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-73', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt> <tt class="py-string">'enc_test.py'</tt><tt class="py-op">)</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">    <tt class="py-name">out</tt> <tt class="py-op">=</tt> <tt id="link-74" class="py-name" targets="Method epydoc.gui.EpydocGUI.open()=epydoc.gui.EpydocGUI-class.html#open"><a title="epydoc.gui.EpydocGUI.open" class="py-name" href="#" onclick="return doclink('link-74', 'open', 'link-74');">open</a></tt><tt class="py-op">(</tt><tt id="link-75" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-75', 'path', 'link-0');">path</a></tt><tt class="py-op">,</tt> <tt class="py-string">'w'</tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">    <tt class="py-name">out</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name" targets="Method epydoc.docintrospecter._DevNull.write()=epydoc.docintrospecter._DevNull-class.html#write,Method epydoc.docwriter.dotgraph.DotGraph.write()=epydoc.docwriter.dotgraph.DotGraph-class.html#write,Method epydoc.docwriter.html.HTMLWriter.write()=epydoc.docwriter.html.HTMLWriter-class.html#write,Method epydoc.docwriter.latex.LatexWriter.write()=epydoc.docwriter.latex.LatexWriter-class.html#write,Method epydoc.docwriter.plaintext.PlaintextWriter.write()=epydoc.docwriter.plaintext.PlaintextWriter-class.html#write"><a title="epydoc.docintrospecter._DevNull.write
epydoc.docwriter.dotgraph.DotGraph.write
epydoc.docwriter.html.HTMLWriter.write
epydoc.docwriter.latex.LatexWriter.write
epydoc.docwriter.plaintext.PlaintextWriter.write" class="py-name" href="#" onclick="return doclink('link-76', 'write', 'link-76');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">textwrap</tt><tt class="py-op">.</tt><tt class="py-name">dedent</tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">    <tt class="py-name">out</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name" targets="Method epydoc.cli.HTMLLogger.close()=epydoc.cli.HTMLLogger-class.html#close,Method epydoc.docintrospecter._DevNull.close()=epydoc.docintrospecter._DevNull-class.html#close,Method epydoc.log.Logger.close()=epydoc.log.Logger-class.html#close,Function epydoc.log.close()=epydoc.log-module.html#close"><a title="epydoc.cli.HTMLLogger.close
epydoc.docintrospecter._DevNull.close
epydoc.log.Logger.close
epydoc.log.close" class="py-name" href="#" onclick="return doclink('link-77', 'close', 'link-77');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">    <tt class="py-comment"># Build docs for it</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">docindex</tt> <tt class="py-op">=</tt> <tt id="link-78" class="py-name"><a title="epydoc.docbuilder.build_doc_index" class="py-name" href="#" onclick="return doclink('link-78', 'build_doc_index', 'link-4');">build_doc_index</a></tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt id="link-79" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-79', 'path', 'link-0');">path</a></tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">introspect</tt><tt class="py-op">,</tt> <tt id="link-80" class="py-name" targets="Function epydoc.markup.epytext.parse()=epydoc.markup.epytext-module.html#parse,Function epydoc.markup.parse()=epydoc.markup-module.html#parse"><a title="epydoc.markup.epytext.parse
epydoc.markup.parse" class="py-name" href="#" onclick="return doclink('link-80', 'parse', 'link-80');">parse</a></tt><tt class="py-op">)</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">docindex</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">    <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">modules</tt><tt class="py-op">.</tt><tt class="py-name">pop</tt><tt class="py-op">(</tt><tt class="py-string">'enc_test'</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">    <tt class="py-comment"># Write html output.</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-name">writer</tt> <tt class="py-op">=</tt> <tt id="link-81" class="py-name"><a title="epydoc.docwriter.html.HTMLWriter" class="py-name" href="#" onclick="return doclink('link-81', 'HTMLWriter', 'link-21');">HTMLWriter</a></tt><tt class="py-op">(</tt><tt class="py-name">docindex</tt><tt class="py-op">,</tt> <tt class="py-name">mark_docstrings</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">    <tt class="py-name">writer</tt><tt class="py-op">.</tt><tt id="link-82" class="py-name"><a title="epydoc.docintrospecter._DevNull.write
epydoc.docwriter.dotgraph.DotGraph.write
epydoc.docwriter.html.HTMLWriter.write
epydoc.docwriter.latex.LatexWriter.write
epydoc.docwriter.plaintext.PlaintextWriter.write" class="py-name" href="#" onclick="return doclink('link-82', 'write', 'link-76');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">file</tt> <tt class="py-keyword">in</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">listdir</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">        <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-83', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt><tt class="py-name">file</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">    <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">rmdir</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">    <tt class="py-comment"># Restore the HTMLWriter class to its original state.</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt id="link-84" class="py-name"><a title="epydoc.docwriter.html.HTMLWriter" class="py-name" href="#" onclick="return doclink('link-84', 'HTMLWriter', 'link-21');">HTMLWriter</a></tt><tt class="py-op">.</tt><tt id="link-85" class="py-name"><a title="epydoc.docwriter.html.HTMLWriter.docstring_to_html" class="py-name" href="#" onclick="return doclink('link-85', 'docstring_to_html', 'link-68');">docstring_to_html</a></tt> <tt class="py-op">=</tt> <tt class="py-name">original_docstring_to_html</tt> </tt>
</div><a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line"> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line"><tt class="py-comment">######################################################################</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#{ Helper Functions</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">######################################################################</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="write_pystring_to_tmp_dir"></a><div id="write_pystring_to_tmp_dir-def"><a name="L173"></a><tt class="py-lineno">173</tt> <a class="py-toggle" href="#" id="write_pystring_to_tmp_dir-toggle" onclick="return toggle('write_pystring_to_tmp_dir');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#write_pystring_to_tmp_dir">write_pystring_to_tmp_dir</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="write_pystring_to_tmp_dir-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="write_pystring_to_tmp_dir-expanded"><a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">    <tt class="py-name">tmp_dir</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">mkdtemp</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">    <tt class="py-name">out</tt> <tt class="py-op">=</tt> <tt id="link-86" class="py-name"><a title="epydoc.gui.EpydocGUI.open" class="py-name" href="#" onclick="return doclink('link-86', 'open', 'link-74');">open</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-87" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-87', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt> <tt class="py-string">'epydoc_test.py'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'w'</tt><tt class="py-op">)</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">    <tt class="py-name">out</tt><tt class="py-op">.</tt><tt id="link-88" class="py-name"><a title="epydoc.docintrospecter._DevNull.write
epydoc.docwriter.dotgraph.DotGraph.write
epydoc.docwriter.html.HTMLWriter.write
epydoc.docwriter.latex.LatexWriter.write
epydoc.docwriter.plaintext.PlaintextWriter.write" class="py-name" href="#" onclick="return doclink('link-88', 'write', 'link-76');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">textwrap</tt><tt class="py-op">.</tt><tt class="py-name">dedent</tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">    <tt class="py-name">out</tt><tt class="py-op">.</tt><tt id="link-89" class="py-name"><a title="epydoc.cli.HTMLLogger.close
epydoc.docintrospecter._DevNull.close
epydoc.log.Logger.close
epydoc.log.close" class="py-name" href="#" onclick="return doclink('link-89', 'close', 'link-77');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">tmp_dir</tt> </tt>
</div><a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"> </tt>
<a name="cleanup_tmp_dir"></a><div id="cleanup_tmp_dir-def"><a name="L180"></a><tt class="py-lineno">180</tt> <a class="py-toggle" href="#" id="cleanup_tmp_dir-toggle" onclick="return toggle('cleanup_tmp_dir');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#cleanup_tmp_dir">cleanup_tmp_dir</a><tt class="py-op">(</tt><tt class="py-param">tmp_dir</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="cleanup_tmp_dir-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="cleanup_tmp_dir-expanded"><a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">    <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-90" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-90', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt> <tt class="py-string">'epydoc_test.py'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-91" class="py-name"><a title="epydoc.apidoc.ModuleDoc.path" class="py-name" href="#" onclick="return doclink('link-91', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">,</tt> <tt class="py-string">'epydoc_test.pyc'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">OSError</tt><tt class="py-op">:</tt> <tt class="py-keyword">pass</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">    <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">rmdir</tt><tt class="py-op">(</tt><tt class="py-name">tmp_dir</tt><tt class="py-op">)</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">    <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">modules</tt><tt class="py-op">.</tt><tt class="py-name">pop</tt><tt class="py-op">(</tt><tt class="py-string">'epydoc_test'</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
</div><a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"> </tt>
<a name="to_plain"></a><div id="to_plain-def"><a name="L187"></a><tt class="py-lineno">187</tt> <a class="py-toggle" href="#" id="to_plain-toggle" onclick="return toggle('to_plain');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#to_plain">to_plain</a><tt class="py-op">(</tt><tt class="py-param">docstring</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="to_plain-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="to_plain-expanded"><a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">    <tt class="py-docstring">"""Conver a parsed docstring into plain text"""</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt id="link-92" class="py-name" targets="Variable epydoc.apidoc.APIDoc.docstring=epydoc.apidoc.APIDoc-class.html#docstring"><a title="epydoc.apidoc.APIDoc.docstring" class="py-name" href="#" onclick="return doclink('link-92', 'docstring', 'link-92');">docstring</a></tt><tt class="py-op">,</tt> <tt id="link-93" class="py-name"><a title="epydoc.markup.ParsedDocstring" class="py-name" href="#" onclick="return doclink('link-93', 'ParsedDocstring', 'link-17');">ParsedDocstring</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">        <tt id="link-94" class="py-name"><a title="epydoc.apidoc.APIDoc.docstring" class="py-name" href="#" onclick="return doclink('link-94', 'docstring', 'link-92');">docstring</a></tt> <tt class="py-op">=</tt> <tt id="link-95" class="py-name"><a title="epydoc.apidoc.APIDoc.docstring" class="py-name" href="#" onclick="return doclink('link-95', 'docstring', 'link-92');">docstring</a></tt><tt class="py-op">.</tt><tt id="link-96" class="py-name" targets="Method epydoc.markup.ConcatenatedDocstring.to_plaintext()=epydoc.markup.ConcatenatedDocstring-class.html#to_plaintext,Method epydoc.markup.ParsedDocstring.to_plaintext()=epydoc.markup.ParsedDocstring-class.html#to_plaintext,Method epydoc.markup.epytext.ParsedEpytextDocstring.to_plaintext()=epydoc.markup.epytext.ParsedEpytextDocstring-class.html#to_plaintext,Function epydoc.markup.epytext.to_plaintext()=epydoc.markup.epytext-module.html#to_plaintext,Method epydoc.markup.javadoc.ParsedJavadocDocstring.to_plaintext()=epydoc.markup.javadoc.ParsedJavadocDocstring-class.html#to_plaintext,Method epydoc.markup.plaintext.ParsedPlaintextDocstring.to_plaintext()=epydoc.markup.plaintext.ParsedPlaintextDocstring-class.html#to_plaintext,Method epydoc.markup.restructuredtext.ParsedRstDocstring.to_plaintext()=epydoc.markup.restructuredtext.ParsedRstDocstring-class.html#to_plaintext"><a title="epydoc.markup.ConcatenatedDocstring.to_plaintext
epydoc.markup.ParsedDocstring.to_plaintext
epydoc.markup.epytext.ParsedEpytextDocstring.to_plaintext
epydoc.markup.epytext.to_plaintext
epydoc.markup.javadoc.ParsedJavadocDocstring.to_plaintext
epydoc.markup.plaintext.ParsedPlaintextDocstring.to_plaintext
epydoc.markup.restructuredtext.ParsedRstDocstring.to_plaintext" class="py-name" href="#" onclick="return doclink('link-96', 'to_plaintext', 'link-96');">to_plaintext</a></tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-97" class="py-name"><a title="epydoc.apidoc.APIDoc.docstring" class="py-name" href="#" onclick="return doclink('link-97', 'docstring', 'link-92');">docstring</a></tt><tt class="py-op">.</tt><tt class="py-name">rstrip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line"> </tt>
<a name="fun_to_plain"></a><div id="fun_to_plain-def"><a name="L193"></a><tt class="py-lineno">193</tt> <a class="py-toggle" href="#" id="fun_to_plain-toggle" onclick="return toggle('fun_to_plain');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#fun_to_plain">fun_to_plain</a><tt class="py-op">(</tt><tt class="py-param">val_doc</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="fun_to_plain-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="fun_to_plain-expanded"><a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">    <tt class="py-docstring">"""Convert parsed docstrings in text from a RoutineDoc"""</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">k</tt><tt class="py-op">,</tt> <tt id="link-98" class="py-name" targets="Variable epydoc.markup.restructuredtext._EpydocReader.v=epydoc.markup.restructuredtext._EpydocReader-class.html#v"><a title="epydoc.markup.restructuredtext._EpydocReader.v" class="py-name" href="#" onclick="return doclink('link-98', 'v', 'link-98');">v</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-99" class="py-name" targets="Variable epydoc.apidoc.RoutineDoc.arg_types=epydoc.apidoc.RoutineDoc-class.html#arg_types"><a title="epydoc.apidoc.RoutineDoc.arg_types" class="py-name" href="#" onclick="return doclink('link-99', 'arg_types', 'link-99');">arg_types</a></tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">        <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-100" class="py-name"><a title="epydoc.apidoc.RoutineDoc.arg_types" class="py-name" href="#" onclick="return doclink('link-100', 'arg_types', 'link-99');">arg_types</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-101" class="py-name" targets="Function epydoc.test.util.to_plain()=epydoc.test.util-module.html#to_plain"><a title="epydoc.test.util.to_plain" class="py-name" href="#" onclick="return doclink('link-101', 'to_plain', 'link-101');">to_plain</a></tt><tt class="py-op">(</tt><tt id="link-102" class="py-name"><a title="epydoc.markup.restructuredtext._EpydocReader.v" class="py-name" href="#" onclick="return doclink('link-102', 'v', 'link-98');">v</a></tt><tt class="py-op">)</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">,</tt> <tt id="link-103" class="py-name"><a title="epydoc.markup.restructuredtext._EpydocReader.v" class="py-name" href="#" onclick="return doclink('link-103', 'v', 'link-98');">v</a></tt><tt class="py-op">)</tt> <tt class="py-keyword">in</tt> <tt class="py-name">enumerate</tt><tt class="py-op">(</tt><tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-104" class="py-name" targets="Variable epydoc.apidoc.RoutineDoc.arg_descrs=epydoc.apidoc.RoutineDoc-class.html#arg_descrs"><a title="epydoc.apidoc.RoutineDoc.arg_descrs" class="py-name" href="#" onclick="return doclink('link-104', 'arg_descrs', 'link-104');">arg_descrs</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">        <tt class="py-name">val_doc</tt><tt class="py-op">.</tt><tt id="link-105" class="py-name"><a title="epydoc.apidoc.RoutineDoc.arg_descrs" class="py-name" href="#" onclick="return doclink('link-105', 'arg_descrs', 'link-104');">arg_descrs</a></tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">,</tt> <tt id="link-106" class="py-name"><a title="epydoc.test.util.to_plain" class="py-name" href="#" onclick="return doclink('link-106', 'to_plain', 'link-101');">to_plain</a></tt><tt class="py-op">(</tt><tt id="link-107" class="py-name"><a title="epydoc.markup.restructuredtext._EpydocReader.v" class="py-name" href="#" onclick="return doclink('link-107', 'v', 'link-98');">v</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line"> </tt>
<a name="print_docstring_as_html"></a><div id="print_docstring_as_html-def"><a name="L200"></a><tt class="py-lineno">200</tt> <a class="py-toggle" href="#" id="print_docstring_as_html-toggle" onclick="return toggle('print_docstring_as_html');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#print_docstring_as_html">print_docstring_as_html</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">parsed_docstring</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-param">varargs</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="print_docstring_as_html-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="print_docstring_as_html-expanded"><a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"><tt class="py-docstring">    Convert the given parsed_docstring to HTML and print it.  Ignore</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"><tt class="py-docstring">    any other arguments.  This function is used by L{testencoding} to</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"><tt class="py-docstring">    monkey-patch the HTMLWriter class's docstring_to_html() method.</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">parsed_docstring</tt><tt class="py-op">.</tt><tt id="link-108" class="py-name" targets="Method epydoc.docwriter.dotgraph.DotGraph.to_html()=epydoc.docwriter.dotgraph.DotGraph-class.html#to_html,Method epydoc.markup.ConcatenatedDocstring.to_html()=epydoc.markup.ConcatenatedDocstring-class.html#to_html,Method epydoc.markup.ParsedDocstring.to_html()=epydoc.markup.ParsedDocstring-class.html#to_html,Method epydoc.markup.epytext.ParsedEpytextDocstring.to_html()=epydoc.markup.epytext.ParsedEpytextDocstring-class.html#to_html,Method epydoc.markup.javadoc.ParsedJavadocDocstring.to_html()=epydoc.markup.javadoc.ParsedJavadocDocstring-class.html#to_html,Method epydoc.markup.plaintext.ParsedPlaintextDocstring.to_html()=epydoc.markup.plaintext.ParsedPlaintextDocstring-class.html#to_html,Method epydoc.markup.restructuredtext.ParsedRstDocstring.to_html()=epydoc.markup.restructuredtext.ParsedRstDocstring-class.html#to_html"><a title="epydoc.docwriter.dotgraph.DotGraph.to_html
epydoc.markup.ConcatenatedDocstring.to_html
epydoc.markup.ParsedDocstring.to_html
epydoc.markup.epytext.ParsedEpytextDocstring.to_html
epydoc.markup.javadoc.ParsedJavadocDocstring.to_html
epydoc.markup.plaintext.ParsedPlaintextDocstring.to_html
epydoc.markup.restructuredtext.ParsedRstDocstring.to_html" class="py-name" href="#" onclick="return doclink('link-108', 'to_html', 'link-108');">to_html</a></tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">,</tt> <tt class="py-string">'xmlcharrefreplace'</tt><tt class="py-op">)</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt id="link-109" class="py-name" targets="Function epydoc.test.util.remove_surrogates()=epydoc.test.util-module.html#remove_surrogates"><a title="epydoc.test.util.remove_surrogates" class="py-name" href="#" onclick="return doclink('link-109', 'remove_surrogates', 'link-109');">remove_surrogates</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">s</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
</div><a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line"> </tt>
<a name="remove_surrogates"></a><div id="remove_surrogates-def"><a name="L212"></a><tt class="py-lineno">212</tt> <a class="py-toggle" href="#" id="remove_surrogates-toggle" onclick="return toggle('remove_surrogates');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="epydoc.test.util-module.html#remove_surrogates">remove_surrogates</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="remove_surrogates-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="remove_surrogates-expanded"><a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line"><tt class="py-docstring">    The following is a helper function, used to convert two-character</tt> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line"><tt class="py-docstring">    surrogate sequences into single characters.  This is needed</tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line"><tt class="py-docstring">    because some systems create surrogates but others don't.</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">    <tt class="py-name">pieces</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">'(&amp;#\d+;)'</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">3</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">pieces</tt><tt class="py-op">)</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">pieces</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-op">!=</tt> <tt class="py-string">''</tt><tt class="py-op">:</tt> <tt class="py-keyword">continue</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line">        <tt class="py-name">high</tt><tt class="py-op">,</tt><tt class="py-name">low</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">pieces</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">pieces</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-number">0xd800</tt> <tt class="py-op">&lt;=</tt> <tt class="py-name">high</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">0xdbff</tt> <tt class="py-keyword">and</tt> <tt class="py-number">0xdc00</tt> <tt class="py-op">&lt;=</tt> <tt class="py-name">low</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">0xdfff</tt><tt class="py-op">:</tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line">            <tt class="py-name">pieces</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">'&amp;#%d;'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">high</tt><tt class="py-op">&amp;</tt><tt class="py-number">0x3ff</tt><tt class="py-op">)</tt><tt class="py-op">&lt;&lt;</tt><tt class="py-number">10</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line">                                     <tt class="py-op">(</tt><tt class="py-name">low</tt><tt class="py-op">&amp;</tt><tt class="py-number">0x3ff</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-number">0x10000</tt><tt class="py-op">)</tt> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">            <tt class="py-name">pieces</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">pieces</tt><tt class="py-op">)</tt> </tt>
</div><a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="epydoc-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://epydoc.sourceforge.net">epydoc 3.0beta1</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    <a href="epydoc-log.html">Generated by Epydoc
    3.0beta1 on Tue Feb 27 06:06:26 2007</a>
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
